package com.ldu.dao.impl;

import com.ldu.dao.query.support.PageResult;
import com.ldu.dao.dataobject.CatelogDO;
import com.ldu.dao.query.CatelogQuery;
import com.ldu.dao.mapper.ext.CatelogExtMapper;
import com.ldu.dao.intf.CatelogManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for Catelog.
 */

@Component
public class CatelogManagerImpl implements CatelogManager{

    
    @Autowired
    protected CatelogExtMapper catelogExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(CatelogQuery query){
        return catelogExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(CatelogQuery query){
        return catelogExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(CatelogDO record){
        return catelogExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(CatelogDO record){
        return catelogExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<CatelogDO> selectByQuery(CatelogQuery query){
        return catelogExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<CatelogDO> selectByQueryWithPage(CatelogQuery query) {
        PageResult<CatelogDO> result = new PageResult<CatelogDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public CatelogDO selectByPrimaryKey(Long id){
        return catelogExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( CatelogDO record,  CatelogQuery query){
        return catelogExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( CatelogDO record,  CatelogQuery query){

        return catelogExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(CatelogDO record){
        return catelogExtMapper.updateByPrimaryKeySelective(record);
    }
}